package it.tukano.swingdeco.event;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.SwingUtilities;

public abstract class MouseAdapterExt implements MouseListener {

    /**
     * Instance initializer
     */
    public MouseAdapterExt() {}

    public void mouseClicked(MouseEvent e) {
        mouseClickedExt(new MouseEventExt(e));
    }

    public void mousePressed(MouseEvent e) {
        MouseEventExt ext = new MouseEventExt(e);
        mousePressedExt(ext);
        if(SwingUtilities.isLeftMouseButton(e)) {
            leftMousePressedExt(ext);
        } else if(SwingUtilities.isRightMouseButton(e)) {
            rightMousePressedExt(ext);
        }
    }

    public void mouseReleased(MouseEvent e) {
        mouseReleasedExt(new MouseEventExt(e));
    }

    public void mouseEntered(MouseEvent e) {
        mouseEnteredExt(new MouseEventExt(e));
    }

    public void mouseExited(MouseEvent e) {
        mouseExitedExt(new MouseEventExt(e));
    }

    protected void mouseClickedExt(MouseEventExt e) {};
    protected void mousePressedExt(MouseEventExt e) {};
    protected void mouseReleasedExt(MouseEventExt e) {};
    protected void mouseEnteredExt(MouseEventExt e) {};
    protected void mouseExitedExt(MouseEventExt e) {};

    protected void leftMousePressedExt(MouseEventExt ext) {

    }

    protected void rightMousePressedExt(MouseEventExt ext) {
    }


}
